
<template lang="jade">

	div.return-bar
		i.iconfont(@click="back()") &#xe668;
		投资明细


	div.user-center.detail_top(v-infinite-scroll="learnmore()" , infinite-scroll-disabled="busy", infinite-scroll-distance="10")
		div.searchinput.cbox.nopos
			div.clx.input1(style="padding:0rem")
				dl.nptype.cbox
					dd(v-bind:class="{ 'on': filter_status == '4'}",v-on:click="setFilterStatus('4', '回款中')") 回款中
					dd(v-bind:class="{ 'on': filter_status == '1'}",v-on:click="setFilterStatus('1', '未结清')") 未结清
					dd(v-bind:class="{ 'on': filter_status == '3'}",v-on:click="setFilterStatus('3', '投标中')") 投标中
					dd(v-bind:class="{ 'on': filter_status == '2'}",v-on:click="setFilterStatus('2', '已结清')") 已结清



		div.cbox.nopos(v-show=" showFilter ", style="padding:0rem 0.2rem")
			flexbox.monthed
				flexbox-item.plusSet(style="text-align:left")
					div(style="padding-top:0.15rem;position:relative;")
						{{star_time}}至
						input(type="date",v-model="date1", v-on:change="setDate1")
						i.iconfont &#xe609;
				flexbox-item.plusSet
					div(style="padding-top:0.15rem;position:relative;")
						{{end_time}}
						input(type="date",v-model="date2", v-on:change="setDate2")
						i.iconfont &#xe609;

		div.cbox.nopos(v-show=" showFilter ", style="padding:0rem 0.2rem", @click=" setShowIncome ")
			flexbox.monthed
				flexbox-item(style="padding:0rem;")
					div(style="padding:0.1rem 0rem;position:relative;")
						待收笔数
						b {{rep.total}}
				flexbox-item(style="padding:0rem;")
					i.iconfont.arrow(v-bind:class="{ 'up': showIncome==true}") &#xe649;
					div(style="padding:0.1rem 0rem;position:relative;")
						待收金额
						b {{rep.money}}

		div.cbox.nopos(v-show=" showFilter==true && showIncome==true ", style="padding:0rem 0.2rem;")
			flexbox.monthed
				flexbox-item(style="padding:0rem;")
					div(style="padding:0.1rem 0rem;position:relative;")
						待收本金
						b {{rep.recover_capital_sum}}
				flexbox-item(style="padding:0rem;")
					div(style="padding:0.1rem 0rem;position:relative;")
						待收利息
						b {{rep.recover_interest_sum}}


		ul.order_filter_status(v-show="  filter_type=='3'  ")
			li.center
				div.input
					calendar(:value.sync="star_time", :weeks-list="weeksList")
				div.input
					calendar(:value.sync="end_time", :weeks-list="weeksList")
				button(@click="searchbyTime()") 确认





		div.cbox.nopos(v-show="showM ", style="padding:0rem 0.2rem")
			flexbox.monthed
					flexbox-item.plusSet(style="text-align:left")
						div(style="padding-top:0.15rem;position:relative;")
							strong(style="float:left") {{invest_txt}}：
							div.l-le(style="float:left;width:28%;position:relative")
								input(:value.sync="star_time1")(placeholder="开始时间")( style="width:100%;float:left;border:none;height:0.60rem;font-size:0.40rem;border-radius:.04rem;color:#808080;background:#F2F2F2")
								input(type="date",v-model="date1", v-on:change="setDate3")(style="width:100%;position:abbsolute;top:0;right:0")
								i.iconfont(style="position:absolute;top:.08rem;left:80%;") &#xe609;
							div.l-le(style="width:33%;float:left;width:28%;position:relative;margin-left:.8rem")
								input( :value.sync="end_time1")(placeholder="结束时间")( style="float:left;width:100%;border:none;height:0.60rem;font-size:0.40rem;border-radius:.04rem;color:#808080;background:#F2F2F2")
								input(type="date",v-model="date1", v-on:change="setDate4")(style="width:100%;position:abbsolute;top:0;right:0")
								i.iconfont(style="position:absolute;top:.08rem;left:80%") &#xe609;
		div.cbox.nopos(v-show=" showM", style="padding:0rem 0.2rem")
			flexbox.monthed
					flexbox-item.plusSet(style="text-align:left")
						div(style="padding-top:0.15rem;position:relative;")
							strong(style="float:left") 投资期限：
							div.l-le(style="float:left;width:18%;position:relative")
								input(:value.sync="star_time2")(v-on:change="inputFunc",v-model="star_time2" )(ref="tq1")(placeholder="1")( style="width:100%;float:left;border:1px solid #ccc;height:0.60rem;font-size:0.40rem;border-radius:.04rem;color:#808080;")
							span(style="float:left;") --
							div.l-le(style="width:18%;float:left;position:relative")
								input.tq2(:value.sync="end_time2")(v-on:change="inputFunc1",v-model="end_time2")(ref="tq2")(placeholder="3")( style="float:left;width:100%;border:1px solid #ccc;height:0.60rem;font-size:0.40rem;border-radius:.04rem;color:#808080;")

								span(style="position:absolute;right:-0.8rem;top:0.06rem") 个月


		div.cbox.nopos(v-show=" showM ", style="padding:0rem 0.2rem", @click=" setShowIncome ")
			flexbox.monthed
				flexbox-item(style="padding:0rem;")
					div(style="padding:0.1rem 0rem;position:relative;")
						投资笔数：
						b {{rep.total}}
				flexbox-item(style="padding:0rem;")
					div(style="padding:0.1rem 0rem;position:relative;")
						投资金额：
						b {{rep.money}}


		div.cbox.nopos(v-show="showM1 ", style="padding:0rem 0.2rem")
			flexbox.monthed
					flexbox-item.plusSet(style="text-align:left")
						div(style="padding-top:0.15rem;position:relative;")
							strong(style="float:left") {{invest_txt}}：
							div.l-le(style="float:left;width:28%;position:relative")
								input(:value.sync="star_time3")(placeholder="开始时间")( style="width:100%;float:left;border:none;height:0.60rem;font-size:0.40rem;border-radius:.04rem;color:#808080;background:#F2F2F2")
								input(type="date",v-model="date4", v-on:change="setDate5")(style="width:100%;position:abbsolute;top:0;right:0")
								i.iconfont(style="position:absolute;top:.08rem;left:80%;") &#xe609;
							div.l-le(style="width:33%;float:left;width:28%;position:relative;margin-left:.8rem")
								input( :value.sync="end_time3")(placeholder="结束时间")( style="width:100%;float:left;border:none;height:0.60rem;font-size:0.40rem;border-radius:.04rem;color:#808080;background:#F2F2F2")
								input(type="date",v-model="date1", v-on:change="setDate6")(style="width:100%;position:abbsolute;top:0;right:0")
								i.iconfont(style="position:absolute;top:.08rem;left:80%;") &#xe609;
		div.cbox.nopos(v-show=" showM1", style="padding:0rem 0.2rem")
			flexbox.monthed
					flexbox-item.plusSet(style="text-align:left")
						div(style="padding-top:0.15rem;position:relative;")
							strong(style="float:left") 投资期限：
							div.l-le(style="float:left;width:18%;position:relative")
								input(:value.sync="star_time4")(v-on:change="inputFunc2")(v-model="star_time4" )(placeholder="1")( style="width:100%;float:left;border:1px solid #ccc;height:0.60rem;font-size:0.40rem;border-radius:.04rem;color:#808080;")
							span(style="float:left;") --
							div.l-le(style="width:18%;float:left;position:relative")
								input(:value.sync="end_time4")(v-on:change="inputFunc3")(v-model="end_time4")(placeholder="3")( style="float:left;width:100%;border:1px solid #ccc;height:0.60rem;font-size:0.40rem;border-radius:.04rem;color:#808080;")

								span(style="position:absolute;right:-0.8rem;top:0.06rem") 个月


		div.cbox.nopos(v-show=" showM1 ", style="padding:0rem 0.2rem", @click=" setShowIncome ")
			flexbox.monthed
				flexbox-item(style="padding:0rem;")
					div(style="padding:0.1rem 0rem;position:relative;")
						投资笔数：
						b {{rep.total}}
				flexbox-item(style="padding:0rem;")
					div(style="padding:0.1rem 0rem;position:relative;")
						投资金额：
						b {{rep.money}}


		div(v-show=" filter_status == '4' " )
			dl.invest_list(v-for="(index, item) in items")
				dd
					div.title(@click="goDetail(item.borrow_nid)")
						span.txt {{item.name}}
						span.date 回款日期:{{item.recover_time}}
					ul.moneylist.triple.clearfix
						li
							strong 投资金额
							span.yellow {{item.account}}
						li
							strong 收益率
							span {{item.borrow_apr}}
						li
							strong 回款期数
							span {{item.recover_period}}/{{item.borrow_period}}
						li
							strong 本期利息
							span {{item.interest}}
						li
							strong 本期本金
							span {{item.capital}}
						li
							strong 还款方式
							span {{item.borrow_style}}
						li
							//a.p_btn 查看
							//a.p_btn.l5( v-bind:class="{ 'on': item.showType == ''}",@click="showFiles(item)",v-if="item.showView") 查看
							//a.p_btn.l5( v-bind:class="{ 'on': item.showType == ''}", @click="showFiles1(item)") 下载
							p(style="font-size:13px;margin-bottom:.2rem") 电子合同
								div(v-if="item.showView" )(style="float:left")
									a.p_btn.l5(@click="showFiles(item,index)",v-if="item.showView")(v-if="item.showType == ''")(v-if="item.showType == ''")(v-if="bg_color") 查看
									a.p_btn.l5( v-bind:class="{ 'on': item.showType == '1'}",@click="showFiles(item,index)",v-if="item.showView")(v-if="item.showType == '1'")(v-if="bg_color1")  查看
								a.p_btn.l5( @click="showFiles1(item,index)")(v-if="item.showType == ''")(v-if="item.showType == ''")(v-if="bg_color1") 下载
								a.p_btn.l5( v-bind:class="{ 'on': item.showType == '1'}", @click="showFiles1(item,index)")(v-if="item.showType == '1'")(v-if="bg_color") 下载

				// ul.files(v-if=" item.showFile ")
				// 	li(v-for="(index, item) in filesList ")
				// 		a(href="{{item.url}}", target="_blank")
				// 			投资合同{{index + 1 }}
				ul.files(v-if=" item.showFile ")
					li(v-for="(index, item) in filesList ")
						a(href="{{item.view}}", target="_blank")(v-if="look")
							投资合同{{index + 1 }}
						a(href="{{item.url}}", target="_blank" )(v-if="load")
							投资合同{{index + 1 }}



		div(v-show=" filter_status == '3' " )
			dl.invest_list(v-for="(index, item) in items")
				dd
					div.title(@click="goDetail(item.borrow_nid)")
						span.txt {{item.name}}
						span.date 投资日期:{{item.tender_time}}
					ul.moneylist.triple.clearfix
						li
							strong 投资金额
							span.yellow {{item.accounts}}
						li
							strong 预期约定收益率
							span {{item.borrow_apr}}
						li
							strong 期限
							span {{item.borrow_period}}

						li
							strong 利息管理费
							span {{item.service_charge}}

		div(v-show=" filter_status == '2' " )
			dl.invest_list(v-for="(index, item) in items")
				dd
					div.title(@click="goDetail(item.borrow_nid)")
						span.txt {{item.name}}
						span.date 结清时间:{{item.repay_yestime}}
					ul.moneylist.triple.clearfix
						li
							strong 投资金额
							span.yellow {{item.tender_account}}
						li
							strong 预期约定收益率
							span {{item.borrow_apr}}
						li
							strong 已还/期数
							span {{item.repay_period}}/{{item.borrow_period}}
						li
							strong 己收利息
							span {{item.recover_interest}}
						//li
							strong 未收利息
							span {{item.unpaid_interest}}
						li
							strong 已收本金
							span {{item.recover_capital}}
						//li
							strong 未收本金
							span {{item.unpaid_capital}}
						li
							strong 利息服务费
							span 0.00
						li
							strong 总收益
							span {{item.recover_account}}
						li
							strong 计息时间
							span {{item.reverify_time}}
						li
							//a.p_btn 查看
							//a.p_btn.l5(@click="showFiles(item)",v-if="item.showView") 查看
							//a.p_btn.l5(@click="showFiles(item)") 下载
							p(style="font-size:13px;margin-bottom:.2rem") 电子合同
								div(v-if="item.showView" )(style="float:left")
									a.p_btn.l5(@click="showFiles(item,index)",v-if="item.showView")(v-if="item.showType == ''")(v-if="item.showType == ''")(v-if="bg_color") 查看
									a.p_btn.l5( v-bind:class="{ 'on': item.showType == '1'}",@click="showFiles(item,index)",v-if="item.showView")(v-if="item.showType == '1'")(v-if="bg_color1")  查看
								a.p_btn.l5( @click="showFiles1(item,index)")(v-if="item.showType == ''")(v-if="item.showType == ''")(v-if="bg_color1") 下载
								a.p_btn.l5( v-bind:class="{ 'on': item.showType == '1'}", @click="showFiles1(item,index)")(v-if="item.showType == '1'")(v-if="bg_color") 下载
				ul.files(v-if=" item.showFile ")
					li(v-for="(index, item) in filesList ")
						a(href="{{item.view}}", target="_blank")(v-if="look")
							投资合同{{index + 1 }}
						a(href="{{item.url}}", target="_blank" )(v-if="load")
							投资合同{{index + 1 }}


		div(v-show=" filter_status == '1' " )
			dl.invest_list(v-for="(index, item) in items")
				dd
					div.title(@click="goDetail(item.borrow_nid)")
						span.txt {{item.name}}
						span.date 投资时间:{{item.tender_time}}
					ul.moneylist.triple.clearfix
						li
							strong 投资金额
							span.yellow {{item.tender_account}}
						li
							strong 预期约定收益率
							span {{item.borrow_apr}}
						li
							strong 已还/期数
							span {{item.repay_period}}/{{item.borrow_period}}
						li
							strong 己收利息
							span {{item.recover_interest}}
						li
							strong 未收利息
							span {{item.unpaid_interest}}
						li
							strong 已收本金
							span {{item.recover_capital}}
						li
							strong 未收本金
							span {{item.unpaid_capital}}
						li
							strong 利息服务费
							span 0.00
						li(style="position:relative")
							//a.p_btn 查看
							p(style="font-size:13px;margin-bottom:.2rem") 电子合同
								div(v-if="item.showView" )(style="float:left")
									a.p_btn.l5(@click="showFiles(item,index)",v-if="item.showView")(v-if="item.showType == ''")(v-if="item.showType == ''")(v-if="bg_color") 查看
									a.p_btn.l5( v-bind:class="{ 'on': item.showType == '1'}",@click="showFiles(item,index)",v-if="item.showView")(v-if="item.showType == '1'")(v-if="bg_color1")  查看
								a.p_btn.l5( @click="showFiles1(item,index)")(v-if="item.showType == ''")(v-if="item.showType == ''")(v-if="bg_color1") 下载
								a.p_btn.l5( v-bind:class="{ 'on': item.showType == '1'}", @click="showFiles1(item,index)")(v-if="item.showType == '1'")(v-if="bg_color") 下载


				ul.files(v-if=" item.showFile ")
					li(v-for="(index, item) in filesList ")
						a(href="{{item.view}}", target="_blank")(v-if="look")
							投资合同{{index + 1 }}
						a(href="{{item.url}}", target="_blank" )(v-if="load")
							投资合同{{index + 1 }}


		div.nodata(v-if="busy") {{returnstr}}



</template>



<script>
import '../../assets/sass/user/index.scss'
import {c_invest} from '../../config/api'
import {Calendar, Flexbox, FlexboxItem} from 'vux'
import api from '../../data/api';
var date1 = new Date, date2 = new Date;
export default{


	data(){
		return{
			invest_txt:"投资时间",

			filesList:[],
			showFile:false,
			showIncome:false,
			year:date1.getFullYear(),
			month:date2.getMonth()+1,
			busy: false,
			page: 1,
			items: [],
			keywords:'',
			filter_type:'',
			showFilter:true,
			showM:false,
			showM1:false,
			look:false,
			load:false,
			filter_status:'4',
			filter_duration:'',
			filter_date:'',
			filter_status_txt:'投标状态',
			filter_duration_txt:'时间段',
			filter_date_txt:'日期',
			star_time:'',
			end_time:'',
			star_time1:'',
			end_time1:'',
			star_time2:'',
			end_time2:'',
			star_time3:'',
			end_time3:'',
			star_time4:'',
			end_time4:'',
			pageK:1,
			bg_color:true,
			bg_color1:false,
			weeksList: ['日', '一', '二', '三', '四', '五', '六 '],
			rep:{
			"money":'0',
			"total":'0',
			"recover_capital_sum":'0',
			"recover_interest_sum":'0'
			},
			returnstr:'正在读取数据...',
			date_filter:''
		}
	},
	/*watch: {
		date: function (val) {
			console.log(val)
			this.year = val.split('-')[0];
			this.month = val.split('-')[1];
		}
	},*/
	components:{
		Calendar,
	    Flexbox,
	    FlexboxItem
	},
	methods: {
		setShowIncome(){
			//console.log('abc')
			this.showIncome = !this.showIncome;
		},
		goDetail(nid){
			this.$route.router.go('/invest/detail/'+nid+'?from=/invest-record');
		},
	    back(){
	      window.history.back();
	    },

	    showFilterFun(){
	    	this.showFilter = !this.showFilter;
	    },
	    setFilterStatus(key, txt){




			this.showFile = false;
	    	if(key=='4')
	    		this.showFilter = true;
	    	else
	    		this.showFilter = false;
	    	this.filter_status = key;
	    	this.page = 1;
	    	this.items = [];

	    	this.filter_type = this.filter_type+'1';
	    	this.filter_status_txt = txt;
			// alert(this.filter_status);
			if(key=='1'){
				this.invest_txt = "投资时间";
				this.showM=true;
				this.showM1=false;
				this.filter_status="1";
				this.pageK=1;
				this.fetch(1,this.star_time1,this.end_time1,this.star_time2,this.end_time2);
			}
			else if(key=="2"){
				this.invest_txt = "结清时间";
				this.showM1=false;
				this.showM=false;
				this.filter_status="2";
				this.pageK=1;
				//this.fetch(1,this.star_time3,this.end_time3,this.star_time4,this.end_time4);
				this.fetch(1,'2016-01-01','2020-01-01',this.star_time4,this.end_time4);
			}
			else if(key=="4"||key=="3"){
				this.invest_txt = "投资时间";
				this.showM=false;
				this.showM1=false;
				this.pageK=1;
				this.fetch(1);
			}

	    },



	    setFilterDuration(key, txt){
	    	this.filter_duration = key;
	    	this.page = 1;
	    	this.items = [];
			this.pageK=1;
	    	this.fetch(1);
	    	this.filter_type = this.filter_type+'1';
	    	this.filter_duration_txt = txt
	    },


	    setFilter(key){
	    	this.filter_type = key;
	    },

		learnmore: function() {
			if(this.busy == true || this.items == ''){
			return false;
			}
			else{
				if(this.filter_status=="1"){
					this.pageK=2;
					this.fetch(++this.page,this.star_time1,this.end_time1,this.star_time2,this.end_time2)
				}
				else if(this.filter_status=="2"){
					this.pageK=2;
					this.fetch(++this.page,this.star_time3,this.end_time3,this.star_time4,this.end_time4);
				}
				else{
					this.fetch(++this.page)
				}

			}

		},

		searchbyKW(){

			if(this.keywords=='') return false;
			//this.filter_status ='';
			this.filter_status_txt ='投标状态';

			this.filter_duration = '';
			this.filter_duration_txt ='时间段';

			this.items = [];
			this.$store.dispatch('setShowLoading', true), this.busy = true;
			this.$http({url: c_invest+'&number=10&keywords='+this.keywords+'&type='+this.filter_status, method: 'GET'}).then(function (response) {
				this.items = response.data.data.list;
				this.$store.dispatch('setShowLoading', false), this.busy = false;
			});
		},

		searchbyTime(){
			this.keywords = '';
			//this.filter_status_txt ='投标状态';
			this.filter_duration = '';
			this.filter_duration_txt ='时间段';
			this.items = [];
			this.$http({url: c_invest+'&number=10&star_time='+this.star_time+'&end_time='+this.end_time, method: 'GET'}).then(function (response) {
				this.items = response.data.data.list;
				this.busy = false;
			});
		},

		async showFiles(item,index){
			//console.log('123')
			//this.showFile = true;
			this.bg_color=false;
			this.bg_color1=true;
			this.look=true;
			this.load=false;
			 for(var d in this.items){
				this.items[d].showFile = false;
				this.items[d].showType = "";
				//console.log(this.items[d])
			}
			this.items[index].showType="1";
			item.showFile  = true;
			var res = await api.user.invest_contract({"borrow_nid":item.borrow_nid});
			this.filesList  = res.data;


		},
		async showFiles1(item,index){
			//console.log('123')
			//this.showFile = true;

			this.bg_color=true;
			this.bg_color1=false;
			this.load=true;
			this.look=false;
			 for(var d in this.items){
				this.items[d].showFile = false;
				this.items[d].showType = "";

				//console.log(this.items[d])
			}
			this.items[index].showType="1";
			// console.log(this.items);

			item.showFile  = true;
			var res = await api.user.invest_contract({"borrow_nid":item.borrow_nid});
			this.filesList  = res.data;


		},

	    setDate1(key){
	    	//console.log(key.target.value)
			this.star_time = key.target.value;
	    	/*this.year = key.target.value.split('-')[0];
	    	this.month = key.target.value.split('-')[1];
	    	this.items = [];
	    	this.page = 1;
	    	this.fetch(1);*/
	    	this.items = [];
	    	this.page = 1;
			this.type=1;
			this.pageK=1;
	    	this.fetch(1);

	    },

	    setDate2(key){
	    	//console.log(key.target.value)
	    	this.end_time = key.target.value;
	    	/*this.year = key.target.value.split('-')[0];
	    	this.month = key.target.value.split('-')[1];
	    	this.items = [];
	    	this.page = 1;
	    	this.fetch(1);*/
	    	this.items = [];
	    	this.page = 1;
	    	this.fetch(1);
	    },
		setDate3(key){
	    	//console.log(key.target.value)
			this.star_time1 = key.target.value;
	    	/*this.year = key.target.value.split('-')[0];
	    	this.month = key.target.value.split('-')[1];
	    	this.items = [];
	    	this.page = 1;
	    	this.fetch(1);*/
	    	this.items = [];
	    	this.page = 1;
			this.filter_status="1";
			this.pageK=1;
	    	this.fetch(1,this.star_time1,this.end_time1,this.star_time2,this.end_time2);

	    },
		setDate4(key){
	    	//console.log(key.target.value)
			this.end_time1 = key.target.value;
	    	/*this.year = key.target.value.split('-')[0];
	    	this.month = key.target.value.split('-')[1];
	    	this.items = [];
	    	this.page = 1;
	    	this.fetch(1);*/
	    	this.items = [];
	    	this.page = 1;
			this.filter_status="1"
	    	this.fetch(1,this.star_time1,this.end_time1,this.star_time2,this.end_time2);

	    },
		setDate5(key){
	    	//console.log(key.target.value)
			this.star_time3 = key.target.value;
	    	/*this.year = key.target.value.split('-')[0];
	    	this.month = key.target.value.split('-')[1];
	    	this.items = [];
	    	this.page = 1;
	    	this.fetch(1);*/
	    	this.items = [];
	    	this.page = 1;
			this.filter_status="2";
			this.pageK=1;
	    	this.fetch(1,this.star_time3,this.end_time3,this.star_time4,this.end_time4);

	    },
		setDate6(key){
	    	//console.log(key.target.value)
			this.end_time3 = key.target.value;
	    	/*this.year = key.target.value.split('-')[0];
	    	this.month = key.target.value.split('-')[1];
	    	this.items = [];
	    	this.page = 1;
	    	this.fetch(1);*/
	    	this.items = [];
	    	this.page = 1;
			this.filter_status="2";
			this.pageK=1;
	    	this.fetch(1,this.star_time3,this.end_time3,this.star_time4,this.end_time4);

	    },



		inputFunc(){
			// this.star_time2=this.$refs.tq1.value;
			// alert(this.star_time2);
			// this.page=1;
			this.page=1;
			this.filter_status=='1'
			this.pageK=1;
			this.fetch(1,this.star_time1,this.end_time1,this.star_time2,this.end_time2);
		},
		inputFunc1(){
			// this.star_time2=this.$refs.tq1.value;
			// alert(this.star_time2);
			this.page=1;
			this.filter_status=='1'
			this.pageK=1;
			this.fetch(1,this.star_time1,this.end_time1,this.star_time2,this.end_time2);
		},
		inputFunc2(){
			// this.star_time2=this.$refs.tq1.value;
			// alert(this.end_time4);
			this.filter_status=='2';
			this.pageK=1;
			this.page=1;
			this.fetch(1,this.star_time3,this.end_time3,this.star_time4,this.end_time4);
		},
		inputFunc3(){
			// this.star_time2=this.$refs.tq1.value;
			// alert(this.star_time2);
			// alert(this.star_time4);
			this.filter_status=='2';
			this.pageK=1;
			this.page=1;
			this.fetch(1,this.star_time3,this.end_time3,this.star_time4,this.end_time4);
			// console.log(this.items);
		},

		fetch: function (page,start_t,end_t,start_period,end_period) {

			this.keywords = '';

			//console.log(this.month)
			// alert(this.filter_status)
			if(this.filter_status=='4')
				this.date_filter = this.year+'-'+this.month;
			//修改  未结清
			// if(this.filter_status=='1'){

			// }
			else
				this.date_filter = "";



			this.$store.dispatch('setShowLoading', true), this.busy = true;
			//var data = {'page': page}
			if(this.filter_status=='1'||this.filter_status=='2'){
				if(this.pageK==1){
					this.items=[];
					this.$http({url: c_invest+'&number=10&type='+this.filter_status+'&time_status='+this.filter_duration+'&page='+this.page+'&star_time='+start_t+'&end_time='+end_t+'&start_period='+start_period+'&end_period='+end_period, method: 'GET'}).then(function (response) {
						this.$store.dispatch('setShowLoading', false);

						//var test = {"msg":"\u6ca1\u6709\u6570\u636e","status":false,"code":30007,"data":false}

						var obj = response.data;
						if(obj.status){
							this.rep = response.data.data;
							if(this.rep!=false){
								this.items = this.items.concat(this.rep.list);
								this.busy = false;
							}else{
								this.rep.money = "0", this.rep.total = "0", this.rep.recover_capital_sum = '0',this.rep.recover_interest_sum = '0';
							}
						}
						else{
							//console.log(this.items.length)
							//return
							if(this.items.length==0){
								this.rep.money = "0", this.rep.total = "0", this.rep.recover_capital_sum = '0',this.rep.recover_interest_sum = '0';
							}
							this.busy = true;
							this.returnstr = this.global.nodateStr
							if(obj.code == '10055'){
								sessionStorage.removeItem("login");
								this.$route.router.go('/login?from='+this.$route.path.substring(1))
							}
							return;
						}
					});
				}
				else if(this.pageK==2){//用于下拉翻页的控制
					this.$http({url: c_invest+'&number=10&type='+this.filter_status+'&time_status='+this.filter_duration+'&page='+this.page+'&star_time='+start_t+'&end_time='+end_t+'&start_period='+start_period+'&end_period='+end_period, method: 'GET'}).then(function (response) {
						this.$store.dispatch('setShowLoading', false);

						//var test = {"msg":"\u6ca1\u6709\u6570\u636e","status":false,"code":30007,"data":false}

						var obj = response.data;
						if(obj.status){
							this.rep = response.data.data;
							if(this.rep!=false){
								this.items = this.items.concat(this.rep.list);
								this.busy = false;
							}else{
								this.rep.money = "0", this.rep.total = "0", this.rep.recover_capital_sum = '0',this.rep.recover_interest_sum = '0';
							}
						}

						else{
							//console.log(this.items.length)
							//return
							if(this.items.length==0){
								this.rep.money = "0", this.rep.total = "0", this.rep.recover_capital_sum = '0',this.rep.recover_interest_sum = '0';
							}
							this.busy = true;
							this.returnstr = this.global.nodateStr
							if(obj.code == '10055'){
								sessionStorage.removeItem("login");
								this.$route.router.go('/login?from='+this.$route.path.substring(1))
							}
							return;
						}
					});
				}

			}

			else{
				this.$http({url: c_invest+'&number=10&type='+this.filter_status+'&time_status='+this.filter_duration+'&page='+this.page+'&star_time='+this.star_time+'&end_time='+this.end_time, method: 'GET'}).then(function (response) {
					this.$store.dispatch('setShowLoading', false);

					//var test = {"msg":"\u6ca1\u6709\u6570\u636e","status":false,"code":30007,"data":false}

					var obj = response.data;

					if(obj.status){
						this.rep = response.data.data;
						if(this.rep!=false){
							this.items = this.items.concat(this.rep.list);
							this.busy = false;
						}else{
							this.rep.money = "0", this.rep.total = "0", this.rep.recover_capital_sum = '0',this.rep.recover_interest_sum = '0';
						}
					}
					else{
						//console.log(this.items.length)
						//return
						if(this.items.length==0){
							this.rep.money = "0", this.rep.total = "0", this.rep.recover_capital_sum = '0',this.rep.recover_interest_sum = '0';
						}
						this.busy = true;
						this.returnstr = this.global.nodateStr
						if(obj.code == '10055'){
							sessionStorage.removeItem("login");
							this.$route.router.go('/login?from='+this.$route.path.substring(1))
						}
						return;
					}
				});
			}

		}
	},


	route:{
		activate( transition ){
			var year1 = date1.getFullYear(), year2 = date1.getFullYear(), month1 = date1.getMonth() , month2 = date1.getMonth();

			if( (month1+1) > 12 ){
				month1 = 1
				year1 = year1 + 1
			}else{
				month1 = month1 + 1
			}

			if( (month2+2) > 12 ){
				month2 = 1
				year2 = year2 + 1
			}else{
				month2 = month2 + 2
			}

			this.star_time = year1 + '-'+ month1 + '-'+date1.getDate()
			this.end_time = year2 + '-'+ month2 + '-'+date1.getDate()
			// this.star_time1 = year1 + '-'+ (month1-1) + '-'+date1.getDate()
			this.star_time1 = "2016-03-26"
			this.end_time1 = year2 + '-'+ month1 + '-'+date1.getDate()
			this.star_time2 = "1"
			this.end_time2 = "36"
			// this.star_time3 = year1 + '-'+ (month1-1) + '-'+date1.getDate()
			this.star_time3 = "2016-03-26"
			this.end_time3 = year2 + '-'+ month1 + '-'+date1.getDate()
			this.star_time4 = "1"
			this.end_time4 = "36";
			this.pageK=1;
			this.fetch(1)
			transition.next();
		}
	}
}

</script>

<style lang="scss" scoped>
.files{
	padding:0px 10px;
	margin-top:20px;
	margin-bottom:10px;
	li{
		margin-bottom:10px;
	}
	a{
		font-size:14px;
		color:#999;
	}
	.on{
		background:red;
	}
}
.user-center .triple li .p_btn{
	border:none;
}
.user-center .triple li .on{
	border: 0.05rem solid #ff9500;
}
</style>
